package com.hitplane.elements.state 
{
	
	import com.hitplane.core.Fly;
	import com.hitplane.interfaces.IState;
	
	import flash.display.MovieClip;
	import flash.events.Event;
	
	/**
	 * @describe  	...
	 * @author  	rrDog
	 * @website 	http://blog.sina.com.cn/zihua2007
	 * @time		... 
	 */
	public class FlyDealState implements IState
	{
		private var _stateType:String = "deal_state";
		private var _fly:Fly;
		
		public const ANIMAL_END:String = "deal_animal_end";
		
		public function FlyDealState(fly:Fly) 
		{
			_fly = fly;
		}
		
		/* INTERFACE com.hitplane.interfaces.IState */
		
		public function startState():void 
		{
			_fly.setShowState(_stateType);
			
			var hitMc:MovieClip=_fly.stateArr[_stateType] as MovieClip;
			hitMc.addFrameScript(hitMc.totalFrames-1,function():void{
				hitMc.dispatchEvent(new Event(ANIMAL_END,true));
				hitMc.addFrameScript(hitMc.totalFrames-1,null);
			});
		}
		
		public function keepState():void 
		{
			
		}
		
		public function stopState():void 
		{
			
		}
		
		public function get stateType():String { return _stateType; }
		
		public function set stateType(value:String):void 
		{
			_stateType = value;
		}
		
	}
	
}